package co.fitstart.entity.user;

import java.math.BigDecimal;
import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Type;
import org.springframework.format.annotation.DateTimeFormat;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

@Entity
@Table(name = "user_target_data")
@JsonIgnoreProperties(value={"hibernate_lazy_initializer","handler","fieldHandler"})
public class UserTargetData {
    
    @Id
    @GeneratedValue
    private Long id;
    
    private Float targetWeight;
    
    private BigDecimal targetBmiValue;
    
    @Type(type = "date")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date expiryDate;
    
    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    private User user;
    
    public UserTargetData() {
        
    }
    
    /**
     * 
     * @param user
     * @return
     */
    public UserTargetData initilization(User user) {
        this.user = user;
        return this;
    }

    /**
     * @return the id
     */
    public Long getId() {
        return id;
    }

    /**
     * @return the targetWeight
     */
    public Float getTargetWeight() {
        return targetWeight;
    }

    /**
     * @return the targetBmiValue
     */
    public BigDecimal getTargetBmiValue() {
        return targetBmiValue;
    }

    /**
     * @return the expiryDate
     */
    public Date getExpiryDate() {
        return expiryDate;
    }

    /**
     * @return the user
     */
    public User getUser() {
        return user;
    }

    /**
     * @param id the id to set
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * @param targetWeight the targetWeight to set
     */
    public void setTargetWeight(Float targetWeight) {
        this.targetWeight = targetWeight;
    }

    /**
     * @param targetBmiValue the targetBmiValue to set
     */
    public void setTargetBmiValue(BigDecimal targetBmiValue) {
        this.targetBmiValue = targetBmiValue;
    }

    /**
     * @param expiryDate the expiryDate to set
     */
    public void setExpiryDate(Date expiryDate) {
        this.expiryDate = expiryDate;
    }

    /**
     * @param user the user to set
     */
    public void setUser(User user) {
        this.user = user;
    }

}
